package com.erju.service;

import com.alibaba.excel.EasyExcel;
import com.erju.excel.DataListener;
import com.erju.pojo.User;
import com.erju.utils.Result;
import org.json.JSONException;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;

public interface UserService {
    Result<?> insertUser(User user);

    Result<?> findAllUser();

    Result<?> findUser(User user);

    Result<?> selectById(Integer id);

    Result<?> updateUser(User user);

    Result<?> deleteUser(User user);

    /**
     * 根据用户名查权限
     *
     * @param UserName
     * @return
     */
    User selectPermissionsByUserName(String UserName);

    /**
     * excel批量导入用户
     *
     * @param file
     * @return
     * @throws IOException
     */
    Result<?> upLoad(MultipartFile file) throws IOException;

    /**
     * 根据用户名上传头像
     *
     * @param file
     * @param username
     * @return
     * @throws IOException
     */
    String uploadPicture(MultipartFile file, String username) throws IOException;

    /**
     * 导出excel
     *
     * @param response
     * @return
     * @throws IOException
     */
    void downloadFailedUsingJson(HttpServletResponse response) throws IOException;

    /**
     * 分页查询
     *
     * @param map
     * @return
     */
    Result selectAllPage(HashMap<String, String> map);

    /**
     * 根据用户名（学号，工号）查看个人信息
     *
     * @param account
     * @return
     */
    Result selectPersonalDetails(String account);

    /**
     * 根据用户名（学号，工号）修改个人信息
     *
     * @param user
     * @return
     */
    Result updatePersonalDetails(User user);

    /**
     * 根据用户名修改密码
     *
     * @param map
     * @return
     */
    Result updatePassword(HashMap<String, String> map);

    /**
     * 手机号查询验证码
     * @param phone_number
     * @return
     */
    Boolean getCaptcha(String phone_number, String templateCode, Map<String,Object> code);
    Result  phonenumberResetPassword(String phone_number,String captcha,String newPassword);
}
